"""
新建单位
"""
import pytest
from Config.Base import Base
from playwright.sync_api import Page, expect, Playwright
from Config.config import *
from Config.URL import *
import allure, os
from Config.Base import Base
from Config.Tool import tool

# 测试用例数据
case_data = {'module':'单位管理','caseid':'新建成功','name':'测试公司001','code':'csgs001','short':'CSGS001'}

@pytest.mark.业务系统
@pytest.mark.项目配置
@allure.step(case_data['caseid'])
def test_case(playwright : Playwright) -> None:
    # 测试结果标题
    allure.dynamic.feature(case_data['module'])
    allure.dynamic.title(case_data['caseid'])
    allure.dynamic.suite(case_data['caseid'])

    SetupTeardown = Base(playwright)
    SetupTeardown.goto(url)
    SetupTeardown.login(username_admin, password_admin)
    context = SetupTeardown.context
    page = SetupTeardown.page
    page.goto(url+url_login)
    page.get_by_placeholder("请输入用户名").click()
    page.get_by_placeholder("请输入用户名").fill(username_admin)
    page.get_by_placeholder("请输入密码").click()
    page.get_by_placeholder("请输入密码").fill(password_admin)
    page.get_by_role("button", name="登 录").click()
    
    page.goto(url_login+url_liuchengsheji)
    page.get_by_role("tree").get_by_text("施工管理").click()
    page.get_by_role("button", name=" 新建流程").click()
    page.get_by_placeholder("请输入流程名称", exact=True).fill("施工技术方案报审-自动化测试")
    page.get_by_placeholder("请输入流程编码").fill("playwright-CB01")
    page.get_by_placeholder("请输入Web地址").fill("projectLevel/constructionSupervision/noticeToProceed/noticeToProceedFlow")
    page.locator("div").filter(has_text=re.compile(r"^是否同步地址$")).locator("span").click()
    page.get_by_role("button", name="确 定").click()
    page.get_by_placeholder("请输入流程名称或编码").fill("CB01")
    page.get_by_role("button", name=" 查询").click()
    page.locator("button").filter(has_text="更多").click()
    page.get_by_text("流程设计图").click()

    allure.step("技术方案签字-1")
    #page.locator(".djs-hit").first.click()
    page.get_by_title("任务节点").click()
    page.locator("svg").filter(has_text="开始").click()
    page.locator(".djs-direct-editing-content").fill("技术方案签字")
    page.get_by_title("修改类型").click()
    page.get_by_text("用户任务").click()
    page.get_by_role("button", name=" 添加角色").first.click()
    page.get_by_placeholder("输入关键词进行搜索").fill("测试角色0001")
    page.get_by_role("treeitem", name=" 测试角色").locator("span").nth(2).click()
    page.get_by_role("button", name="确 定").click()
    page.get_by_role("tab", name="高级").click()
    page.get_by_role("button", name=" 请选择业务规则").click()
    page.get_by_label("请选择业务规则").get_by_text("施工管理").click()
    page.get_by_role("row", name="1 合并业务表单与附件").locator("label span").nth(1).click()
    page.get_by_role("row", name="2 上传签章附件").locator("label span").nth(1).click()
    page.get_by_role("button", name="确 定").click()
    page.get_by_role("tab", name="签章").click()
    page.get_by_label("签章").locator("span").nth(1).click()
    page.locator("div:nth-child(4) > .el-switch > .el-switch__core").first.click()
    page.locator("div:nth-child(8) > .el-switch > .el-switch__core").click()
    page.locator("label").filter(has_text="签字").locator("span").nth(1).click()
    page.locator("label").filter(has_text="日期").locator("span").nth(1).click()
    page.get_by_role("tab", name="权限").click()
    page.get_by_role("button", name=" 选择系统字段").click()
    page.get_by_role("row", name="施工监理用表 SGJLYB 1 2023-06-16 16:00").locator("label span").nth(1).click()
    page.get_by_role("button", name="确 定").click()
    page.get_by_role("button", name="保存", exact=True).click()
    expect(page.get_by_role("alert")).to_contain_text("保存成功")
    tool.element_drag_and_drop(page, page.locator("g:nth-child(3) > .djs-element > .djs-hit"),{'x': 100, 'y': -65})


    allure.step("技术方案盖章-2")
    page.get_by_title("任务节点").click()
    page.locator("svg").filter(has_text="开始").click()
    page.locator(".djs-direct-editing-content").fill("技术方案盖章")
    page.get_by_title("修改类型").click()
    page.get_by_text("用户任务").click()
    page.get_by_role("button", name=" 添加角色").first.click()
    page.get_by_placeholder("输入关键词进行搜索").fill("测试角色0001")
    page.get_by_role("treeitem", name=" 测试角色").locator("span").nth(2).click()
    page.get_by_role("button", name="确 定").click()
    page.get_by_role("tab", name="签章").click()
    page.get_by_label("签章").locator("span").nth(1).click()
    #上传签章文件
    #page.locator("div:nth-child(4) > .el-switch > .el-switch__core").first.click()
    #手动签字盖章
    page.locator("div:nth-child(8) > .el-switch > .el-switch__core").click()
    #page.locator("label").filter(has_text="签字").locator("span").nth(1).click()
    page.locator("label").filter(has_text="盖章").locator("span").nth(1).click()
    #page.locator("label").filter(has_text="日期").locator("span").nth(1).click()
    page.get_by_role("tab", name="权限").click()
    page.get_by_role("button", name=" 选择系统字段").click()
    page.get_by_role("row", name="施工监理用表 SGJLYB 1 2023-06-16 16:00").locator("label span").nth(1).click()
    page.get_by_role("button", name="确 定").click()

    #表单填报按钮
    page.locator(
        "tr:nth-child(1) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(1) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    #新增表单按钮
    page.locator(
        "tr:nth-child(2) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(2) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()
    #新建附件按钮
    page.locator(
        "tr:nth-child(3) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(3) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    #删除附件按钮
    page.locator(
        "tr:nth-child(4) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(4) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    #版本更新附件按钮
    page.locator(
        "tr:nth-child(5) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(5) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    #数据明细区域
    page.locator(
        "tr:nth-child(6) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(6) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    #业务表单区域
    page.locator(
        "tr:nth-child(7) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(7) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    #附件区域
    page.locator(
        "tr:nth-child(8) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(8) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    #编辑明细
    page.locator(
        "tr:nth-child(9) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(9) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    #新增明细
    page.locator(
        "tr:nth-child(10) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(10) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    #删除明细
    page.locator(
        "tr:nth-child(11) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(11) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    page.get_by_role("button", name="保存", exact=True).click()
    expect(page.get_by_role("alert")).to_contain_text("保存成功")
    tool.element_drag_and_drop(page, page.locator("g:nth-child(4) > .djs-element > .djs-hit"), {'x': 400, 'y': -65})

    allure.step("填表技术方案申报表-3")
    # page.locator(".djs-hit").first.click()
    page.get_by_title("任务节点").click()
    page.locator("svg").filter(has_text="开始").click()
    page.locator(".djs-direct-editing-content").fill("填表技术方案申报表")
    page.get_by_title("修改类型").click()
    page.get_by_text("用户任务").click()
    page.get_by_role("button", name=" 添加角色").first.click()
    page.get_by_placeholder("输入关键词进行搜索").fill("测试角色0001")
    page.get_by_role("treeitem", name=" 测试角色").locator("span").nth(2).click()
    page.get_by_role("button", name="确 定").click()
    page.get_by_role("tab", name="高级").click()
    page.get_by_role("button", name=" 请选择业务规则").click()
    page.get_by_label("请选择业务规则").get_by_text("施工管理").click()
    page.get_by_role("row", name="1 合并业务表单与附件").locator("label span").nth(1).click()
    page.get_by_role("row", name="2 上传签章附件").locator("label span").nth(1).click()
    page.get_by_role("row", name="3 填报业务表单").locator("label span").nth(1).click()
    page.get_by_role("button", name="确 定").click()
    # page.get_by_role("tab", name="签章").click()
    # page.get_by_label("签章").locator("span").nth(1).click()
    # page.locator("div:nth-child(4) > .el-switch > .el-switch__core").first.click()
    # page.locator("div:nth-child(8) > .el-switch > .el-switch__core").click()
    # page.locator("label").filter(has_text="签字").locator("span").nth(1).click()
    # page.locator("label").filter(has_text="日期").locator("span").nth(1).click()
    page.get_by_role("tab", name="权限").click()
    page.get_by_role("button", name=" 选择系统字段").click()
    page.get_by_role("row", name="施工监理用表 SGJLYB 1 2023-06-16 16:00").locator("label span").nth(1).click()
    page.get_by_role("button", name="确 定").click()
    # 表单填报按钮
    # page.locator(
    #     "tr:nth-child(1) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(1) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    # 新增表单按钮
    # page.locator(
    #     "tr:nth-child(2) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    # page.locator(
    #     "tr:nth-child(2) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()
    # 新建附件按钮
    # page.locator(
    #     "tr:nth-child(3) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(3) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    # 删除附件按钮
    # page.locator(
    #     "tr:nth-child(4) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(4) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    # 版本更新附件按钮
    # page.locator(
    #     "tr:nth-child(5) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(5) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    # 数据明细区域
    # page.locator(
    #     "tr:nth-child(6) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(6) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    # 业务表单区域
    # page.locator(
    #     "tr:nth-child(7) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(7) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    # 附件区域
    # page.locator(
    #     "tr:nth-child(8) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(8) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    # 编辑明细
    # page.locator(
    #     "tr:nth-child(9) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(9) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    # 新增明细
    # page.locator(
    #     "tr:nth-child(10) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(10) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    # 删除明细
    # page.locator(
    #     "tr:nth-child(11) >td:nth-child(4) > .cell > label > .el-checkbox__input > .el-checkbox__inner").first.click()
    page.locator(
        "tr:nth-child(11) >td:nth-child(4) > .cell > label:nth-child(2) > .el-checkbox__input > .el-checkbox__inner").first.click()

    page.get_by_role("button", name="保存", exact=True).click()
    expect(page.get_by_role("alert")).to_contain_text("保存成功")
    tool.element_drag_and_drop(page, page.locator("g:nth-child(5) > .djs-element > .djs-hit"), {'x': 700, 'y': -65})

    allure.step("施工单位项目技术负责人-审核-4")
    # page.locator(".djs-hit").first.click()
    page.get_by_title("任务节点").click()
    page.locator("svg").filter(has_text="开始").click()
    page.locator(".djs-direct-editing-content").fill("施工单位项目技术负责人-审核")
    page.get_by_title("修改类型").click()
    page.get_by_text("用户任务").click()
    page.get_by_role("button", name=" 添加角色").first.click()
    page.get_by_placeholder("输入关键词进行搜索").fill("测试角色0001")
    page.get_by_role("treeitem", name=" 测试角色").locator("span").nth(2).click()
    page.get_by_role("button", name="确 定").click()
    page.get_by_role("button", name="保存", exact=True).click()
    expect(page.get_by_role("alert")).to_contain_text("保存成功")
    tool.element_drag_and_drop(page, page.locator("g:nth-child(6) > .djs-element > .djs-hit"), {'x': 1000, 'y': -65})

    allure.step("施工单位项目经理-审核-5")
    # page.locator(".djs-hit").first.click()
    page.get_by_title("任务节点").click()
    page.locator("svg").filter(has_text="开始").click()
    page.locator(".djs-direct-editing-content").fill("施工单位项目经理-审核")
    page.get_by_title("修改类型").click()
    page.get_by_text("用户任务").click()
    page.get_by_role("button", name=" 添加角色").first.click()
    page.get_by_placeholder("输入关键词进行搜索").fill("测试角色0001")
    page.get_by_role("treeitem", name=" 测试角色").locator("span").nth(2).click()
    page.get_by_role("button", name="确 定").click()
    page.get_by_role("button", name="保存", exact=True).click()
    expect(page.get_by_role("alert")).to_contain_text("保存成功")
    tool.element_drag_and_drop(page, page.locator("g:nth-child(7) > .djs-element > .djs-hit"), {'x': 1300, 'y': -65})

    allure.step("监理单位监理工程师/总监理工程师-审批-6")
    # page.locator(".djs-hit").first.click()
    page.get_by_title("任务节点").click()
    page.locator("svg").filter(has_text="开始").click()
    page.locator(".djs-direct-editing-content").fill("监理单位监理工程师/总监理工程师-审批")
    page.get_by_title("修改类型").click()
    page.get_by_text("用户任务").click()
    page.get_by_role("button", name=" 添加角色").first.click()
    page.get_by_placeholder("输入关键词进行搜索").fill("测试角色0001")
    page.get_by_role("treeitem", name=" 测试角色").locator("span").nth(2).click()
    page.get_by_role("button", name="确 定").click()
    page.get_by_role("button", name="保存", exact=True).click()
    expect(page.get_by_role("alert")).to_contain_text("保存成功")
    tool.element_drag_and_drop(page, page.locator("g:nth-child(8) > .djs-element > .djs-hit"), {'x': 1600, 'y': -65})

    allure.step("施工单位项目经理-签字盖章-7")
    # page.locator(".djs-hit").first.click()
    page.get_by_title("任务节点").click()
    page.locator("svg").filter(has_text="开始").click()
    page.locator(".djs-direct-editing-content").fill("施工单位项目经理-签字盖章")
    page.get_by_title("修改类型").click()
    page.get_by_text("用户任务").click()
    page.get_by_role("button", name=" 添加角色").first.click()
    page.get_by_placeholder("输入关键词进行搜索").fill("测试角色0001")
    page.get_by_role("treeitem", name=" 测试角色").locator("span").nth(2).click()
    page.get_by_role("button", name="确 定").click()
    page.get_by_role("tab", name="签章").click()
    #开启流程签章
    page.get_by_label("签章").locator("span").first.click()
    #开启文件签章
    page.get_by_label("签章").locator("span").nth(1).click()
    #上传签章文件
    page.locator("div:nth-child(4) > .el-switch > .el-switch__core").first.click()
    #签章关键字
    page.get_by_label("签章").get_by_role("textbox").fill("施工单位")
    #签章类型
    page.locator("label").filter(has_text="签字").locator("span").nth(1).click()
    page.locator("label").filter(has_text="盖章").locator("span").nth(1).click()
    page.locator("label").filter(has_text="日期").locator("span").nth(1).click()
    page.get_by_role("button", name="保存", exact=True).click()
    expect(page.get_by_role("alert")).to_contain_text("保存成功")
    tool.element_drag_and_drop(page, page.locator("g:nth-child(9) > .djs-element > .djs-hit"), {'x': 1900, 'y': -65})

    allure.step("监理单位监理工程师/总监理工程师-签字盖章-8")
    # page.locator(".djs-hit").first.click()
    page.get_by_title("任务节点").click()
    page.locator("svg").filter(has_text="开始").click()
    page.locator(".djs-direct-editing-content").fill("监理单位监理工程师/总监理工程师-签字盖章")
    page.get_by_title("修改类型").click()
    page.get_by_text("用户任务").click()
    page.get_by_role("button", name=" 添加角色").first.click()
    page.get_by_placeholder("输入关键词进行搜索").fill("测试角色0001")
    page.get_by_role("treeitem", name=" 测试角色").locator("span").nth(2).click()
    page.get_by_role("button", name="确 定").click()
    page.get_by_role("tab", name="签章").click()
    # 开启流程签章
    page.get_by_label("签章").locator("span").first.click()
    # 开启文件签章
    page.get_by_label("签章").locator("span").nth(1).click()
    # 上传签章文件
    #page.locator("div:nth-child(4) > .el-switch > .el-switch__core").first.click()
    # 签章关键字
    page.get_by_label("签章").get_by_role("textbox").fill("监理单位")
    # 签章类型
    page.locator("label").filter(has_text="签字").locator("span").nth(1).click()
    page.locator("label").filter(has_text="盖章").locator("span").nth(1).click()
    page.locator("label").filter(has_text="日期").locator("span").nth(1).click()
    page.get_by_role("button", name="保存", exact=True).click()
    expect(page.get_by_role("alert")).to_contain_text("保存成功")
    tool.element_drag_and_drop(page, page.locator("g:nth-child(10) > .djs-element > .djs-hit"), {'x': 2200, 'y': -65})

    allure.step("结束节点")
    page.get_by_title("结束节点").click()
    page.locator("svg").filter(has_text="开始").click()
    page.locator("g:nth-child(11) > .djs-element > .djs-hit").click()
    page.wait_for_timeout(1000)
    page.locator("div").filter(has_text=re.compile(r"^节点名称$")).get_by_role("textbox").fill("结束")
    page.get_by_role("button", name="保存", exact=True).click()
    expect(page.get_by_role("alert")).to_contain_text("保存成功")
    tool.element_drag_and_drop(page, page.locator("g:nth-child(11) > .djs-element > .djs-hit"), {'x': 2500, 'y': -65})

    page.wait_for_timeout(3000)
    page.get_by_role("button", name="保存模型").click()
    expect(page.get_by_role("alert")).to_contain_text("请求成功")
    #----------------------------------------------------------------------------------------------------------------------------------
    # ------连线----------------------------------------------------------------------------------------------------------------------------
    # ----------------------------------------------------------------------------------------------------------------------------------



    page.get_by_placeholder("请输入流程名称或编码").fill("CB01")
    page.get_by_role("button", name=" 查询").click()
    page.wait_for_timeout(1000)
    page.locator("button").filter(has_text="更多").click()
    page.get_by_text("流程设计图").click()
    page.get_by_role("button", name="").click()


    page.locator(".djs-hit").first.click()
    page.get_by_title("使用顺序/消息流或者关联连接").click()
    page.locator("g:nth-child(3) > .djs-element > .djs-hit").click()
    page.get_by_title("使用顺序/消息流或者关联连接").click()
    page.locator("g:nth-child(5) > .djs-element > .djs-hit").click()
    page.get_by_title("使用顺序/消息流或者关联连接").click()
    page.locator("g:nth-child(7) > .djs-element > .djs-hit").click()
    page.get_by_title("使用顺序/消息流或者关联连接").click()
    page.locator("g:nth-child(9) > .djs-element > .djs-hit").click()
    page.get_by_title("使用顺序/消息流或者关联连接").click()
    page.locator("g:nth-child(11) > .djs-element > .djs-hit").click()
    page.get_by_title("使用顺序/消息流或者关联连接").click()
    page.locator("g:nth-child(13) > .djs-element > .djs-hit").click()
    page.get_by_title("使用顺序/消息流或者关联连接").click()
    page.locator("g:nth-child(15) > .djs-element > .djs-hit").click()
    page.get_by_title("使用顺序/消息流或者关联连接").click()
    page.locator("g:nth-child(17) > .djs-element > .djs-hit").click()
    page.get_by_title("使用顺序/消息流或者关联连接").click()
    page.locator("g:nth-child(19) > .djs-element > .djs-hit").click()


    page.wait_for_timeout(3000)
    page.get_by_role("button", name="保存模型").click()
    expect(page.get_by_role("alert")).to_contain_text("请求成功")




    # 断言
    #expect(page.get_by_text('新建成功！')).to_be_visible()

    # 测试结果截图
    filename = os.path.join(test_screenshot_dir, f"{case_data['caseid']}.png")
    page.screenshot(path=filename)
    allure.attach.file(source=filename, name=case_data['caseid'],
                       attachment_type=allure.attachment_type.PNG)


    # page.get_by_placeholder("请输入名称").fill(case_data['name'])
    # page.get_by_role("button", name=" 查询").click()
    # # 获取tbody下面元素tr个数
    # expect(page.locator("tbody > tr")).to_have_count(1)
    # # 获取是否存在文本text
    # expect(page.locator("tbody")).to_contain_text(case_data['name'])
    # page.get_by_role("button", name="删除").click()
    # page.get_by_role("button", name="确 定").click()
    # expect(page.get_by_text('删除成功！')).to_be_visible()

    SetupTeardown.close()
